<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%//Grab the username and password form the login page
String uname=(String)session.getAttribute("userName");
//String emp_id=(String)session.getAttribute("emp_id");
//int ei=Integer.parseInt(emp_id);
//String tname=request.getParameter("taskName");
String task_id=request.getParameter("tid");
int tid=Integer.parseInt(task_id);
String pname=null;
String taskname=null;
String tsummary=null;
String ttype=null;
String tstatus=null;
String tet=null;
%>
<%
String query="select task.type,task.estimated_date,task.status,task.name,task.summary,project.name from task ,project where task.task_id='"+tid+"'"+" and task.project_id=project.project_id";
Connection db_conn = null;
Statement statement = null;
PreparedStatement pstmt;
ResultSet rs;
try{
Class.forName("com.mysql.jdbc.Driver");
String url= "jdbc:mysql://localhost:3306/db";
db_conn = DriverManager.getConnection( url,"root", "root" );
statement = db_conn.createStatement();
rs=statement.executeQuery(query);
while (rs.next()) { // parse the results
pname=rs.getString("project.name");
tsummary=rs.getString("task.summary");
taskname=rs.getString("task.name");
ttype=rs.getString("task.type");
tstatus=rs.getString("task.status");
tet=rs.getString("task.estimated_date");
}
db_conn.close();
} catch(SQLException e){
e.printStackTrace();
out.println("sql not found");
out.println(e);
} catch(ClassNotFoundException e){
e.printStackTrace();
out.println(e);
}


%>    
<h1>Hello <span class="green"> <%= uname%></span></h1>
<h1>It's <span class="green"><%= new java.util.Date() %></span></h1>
<table width="400" align="center">
    <tr bgcolor="#EEEEEE" height="20px">
        <th width="121" scope="col">Name</th>
        <th width="308" scope="col">Description</th>
    </tr>
    <tr bgcolor="#FFFFFF">
        <td>Name</td>
        <td><%= taskname%></td>
    </tr>
    <tr bgcolor="#FCFCFC">
        <td>Project</td>
        <td>
            
            <a href="user.jsp?pageid=project&&projectName=<%=pname%>"><%= pname%></a>		
            
        </td>
    </tr>
    <tr bgcolor="#FFFFFF">
        <td>Estimated time</td>
        <td><%= tet%></td>
    </tr>
    <tr bgcolor="#FCFCFC">
        <td>elapsed time</td>
        <td><%= pname%></td>
    </tr>
    <tr bgcolor="#FFFFFF">
        <td>summary</td>
        <td><%= tsummary%></td>
    </tr>
    <tr bgcolor="#FCFCFC">
        <td>type</td>
        <td><%= ttype%></td>
    </tr>
    <tr bgcolor="#FFFFFF">
        <td>status</td>
        <td><%= tstatus%></td>
    </tr>
</table>
